import { get, post, del, put } from '@/utils/request'

// 获取供应商列表
export const getProviders = (params) => {
  return get('/product/product-client/api/supplierInfo/list?' + new URLSearchParams(params).toString())
}

// 获取供应商详情
export const getProviderDetail = (id) => {
  return get(`/product/product-client/api/supplierInfo/get/${id}`)
}

// 新增供应商
export const createProvider = (data) => {
  return post('/product/product-client/api/supplierInfo/add', data)
}

// 更新供应商
export const updateProvider = (data) => {
  return put(`/product/product-client/api/supplierInfo/update/${data.id}`, data)
}

// 删除供应商
export const deleteProvider = (id) => {
  return del(`/product/product-client/api/supplierInfo/delete/${id}`)
}

// 按名称模糊查询供应商（分页）
export const searchProvidersByName = (params) => {
  return get('/product/product-client/api/supplierInfo/searchByName', params);
}
